//
//  NSObject+NetworkState.m
//  Civacrm
//
//  Created by 王桂敏 on 2017/2/17.
//  Copyright © 2017年 王桂敏. All rights reserved.
//

#import "NSObject+NetworkingState.h"
#import "AFNetworkReachabilityManager.h"
#import "AFNetworkActivityIndicatorManager.h"

@implementation NSObject (NetworkState)

- (void)changeNetworkState
{
    AFNetworkReachabilityManager *manager = [AFNetworkReachabilityManager sharedManager];
    [AFNetworkActivityIndicatorManager sharedManager].enabled = YES;
    @weakify(self);
    [manager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
        @strongify(self);
        [self postNotificationName:kNotificationNetState object:nil];
    }];
    [manager startMonitoring];
}



@end
